package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Project;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.mapper.ProjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProjectService {
    @Autowired
    private ProjectMapper projectsMapper;
    public PageInfo<Project> get(int pageNum, int pageSize, Project project){
        PageHelper.startPage(pageNum,pageSize);
        List<Project> employeesList  = projectsMapper.get(project);
        return PageInfo.of(employeesList);
    }
    public String save(Project project){
        if(projectsMapper.save(project)){
            return "保存成功";
        }
        return "保存失败";
    }
    public String update(Project project){
        if(projectsMapper.update(project)){
            return "修改成功";
        }
        return "修改失败";
    }
    public String delete(int id){
        if(projectsMapper.delete(id)){
            return "删除成功";
        }
        return "删除失败";
    }
}